<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<div id="log"></div>
<script>
test(() => {
    assert_selection(
        [
            '<div contenteditable>',
            '<table><tr><td>^hello</td><td>wor|ld</td></tr></table>',
            '<div id="target">replaceme</div>',
        ].join(''),
        selection => {
            selection.document.execCommand('copy');
            var target = selection.document.getElementById('target');
            selection.collapse(target, 0);
            selection.extend(target, 1);
            selection.document.execCommand('paste');
        },
        [
            '<div contenteditable>',
            '<table><tbody><tr><td>hello</td><td>world</td></tr></tbody></table>',
            '<div id="target">',
            '<table><tbody><tr><td>hello</td><td>wor|</td></tr></tbody></table>',
            '</div>',
            '</div>',
        ].join(''));
});
</script>
